package com.qf.day06.homework;

import java.util.Scanner;

public class UserTest {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        UserUtils userUtils = new UserUtils();
        while (true) {
            System.out.println("======欢迎您来到valorlent用户管理系统======");
            System.out.println("=====请输入数字,1:登录,2:注册,3:退出======");
            int num = scanner.nextInt();

            switch (num) {
                case 1:
                    System.out.println("===欢迎来到valorlent登录系统===");
                    System.out.println("请输入用户名");
                    String userName = scanner.next();
                    System.out.println("请输入密码");
                    String passWord = scanner.next();
                    if (userUtils.login(userName, passWord)) {
                        System.out.println("登陆成功");
                    } else {
                        System.out.println("登陆失败");
                    }
                    break;
                case 2:
                    System.out.println("===欢迎来到valorlent注册系统===");
                    System.out.println("请输入用户名");
                    String userName1 = scanner.next();
                    System.out.println("请输入密码");
                    String passWord1 = scanner.next();
                    if (userUtils.register(userName1, passWord1)) {

                        System.out.println("注册成功");

                    } else {
                        System.out.println("注册失败");
                    }
                    break;
                case 3:
                    System.out.println("===再见===");
                    return;
                default:
                    System.out.println("输入有误");
            }

        }
    }
}
